import React, { Component } from 'react';
import {FlatList, Image, Text, TouchableOpacity, View} from 'react-native';
import Styles from "../FootballGame/Styles";

export default class HelloWorldApp extends Component {
    constructor(props) {
        super(props);
        this.state = {
            refreshing: false,
            modalVisible: false,
            single_type:[
                ["混合投注","胜平负","半全场","比分","进球数"],//过关
                ["胜平负","半全场","比分","进球数"]//单关
            ],
            curr_single_type:{id:1,data:'半全场'},
            ball_addr:['日职','欧管','日职已','欧联'],
            curr_ball_addr:['日职','欧管','日职已','欧联'],
            select_boll_addr:[]
        };
    }
    change_ball_addr=(data)=>{
        let curr_ball_addr = this.state.curr_ball_addr;
        let temp=[];
        for (let i =0;i<curr_ball_addr.length;i++){
            if(data == curr_ball_addr[i]){
                continue;
            }
            temp.push(curr_ball_addr[i])
        }
        this.setState({
            curr_ball_addr:temp
        })
        console.log(this.state.curr_ball_addr);
    }
    _render_ball_addr_item=(curr_ball_addr,item, index, separators)=>{
        return (
            <TouchableOpacity onPress={() => this.change_ball_addr(item)}>
                <View style={Styles.list_item_on} >
                    <Text style={{textAlign:'center'}}>{item}--->{curr_ball_addr}</Text>
                    <Image resizeMode="cover" style={Styles.bj} source={require('../../image/js_img_liansai_checked.png')} />
                </View>
            </TouchableOpacity>
        );

    }
    render() {
        let {ball_addr,curr_ball_addr} = this.state;
        console.log(curr_ball_addr);
        return (
            <View style={{ flex: 1, justifyContent: "center", alignItems: "center" ,paddingTop:50}}>
                <FlatList
                    numColumns={1}
                    horizontal={false}
                    data={ball_addr}
                    extraData={this.state}
                    renderItem={({item}) =>
                        <TouchableOpacity onPress={() => this.change_ball_addr(item)}>
                            <View style={Styles.list_item_on} >
                                <Text style={{textAlign:'center'}}>{item}--->{curr_ball_addr}</Text>
                                <Image resizeMode="cover" style={Styles.bj} source={require('../../image/js_img_liansai_checked.png')} />
                            </View>
                        </TouchableOpacity>
                    }
                />
            </View>
        );
    }
}
